﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ISqlSchemaReader.cs" company="MyCoreLib">
//   Copyright (C) 2014 Alexey Evlampiev. All rights reserved.
// </copyright>
// <summary>
//   SQL schema reader.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace MyCoreLib.Automation.Data.SqlClient.Metadata
{
    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// SQL schema reader.
    /// </summary>
    public interface ISqlSchemaReader
    {
        /// <summary>
        /// Gets the stored procedure full names asynchronous.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>Task extracting an array of stored procedure full names.</returns>
        Task<string[]> LoadStoredProcedureFullNamesAsync(CancellationToken token);

        /// <summary>
        /// Loads the user table type full names asynchronous.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>Task extracting an array of user table type full names.</returns>
        Task<string[]> LoadUserTableTypeFullNamesAsync(CancellationToken token);

        /// <summary>
        /// Loads the SQLCLR type metadata asynchronous.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>Task extracting a collection of SQLCLR type metadata.</returns>
        Task<SqlClrTypeMetadataCollection> LoadSqlClrTypeMetadataAsyn(CancellationToken token);

        /// <summary>
        /// Loads the SQL user table type metadata asynchronous.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>Task extracting a collection of user table type metadata.</returns>
        Task<SqlUserTableTypeMetadataCollection> LoadSqlUserTableTypeMetadataAsyn(CancellationToken token);

        /// <summary>
        /// Loads the selected stored procedure metadata asynchronous.
        /// </summary>
        /// <param name="selectedProcedureFullNames">The selected procedure full names.</param>
        /// <param name="loadStoredProcedureFullNamesTask">The load stored procedure full names task.</param>
        /// <param name="loadSqlClrMetadataTask">The load SQL color metadata task.</param>
        /// <param name="loadSqlUserTableTypeMetadataTask">The load SQL user table type metadata task.</param>
        /// <param name="token">The token.</param>
        /// <returns>Task extracting a collection of stored procedure metadata.</returns>
        Task<SqlStoredProcedureMetadataCollection> LoadSelectedStoredProcedureMetadataAsync(
            IEnumerable<string> selectedProcedureFullNames,
            Task<string[]> loadStoredProcedureFullNamesTask,
            Task<SqlClrTypeMetadataCollection> loadSqlClrMetadataTask,
            Task<SqlUserTableTypeMetadataCollection> loadSqlUserTableTypeMetadataTask,
            CancellationToken token);
    }
}